import classNames from 'classnames'
import React from 'react'
import styles from './index.module.scss'

export default function Textarea({
  maxLength,
  placeholder,
  className,
  value,
  onChange,
}) {
  return (
    <div className={classNames(styles.root, className)}>
      {/* 文本输入框 */}
      <textarea
        className="textarea"
        maxLength={maxLength}
        placeholder={placeholder}
        value={value}
        onChange={onChange}
      />

      {/* 当前字数/最大允许字数 */}
      <div className="count">
        {value.length}/{maxLength}
      </div>
    </div>
  )
}
